<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SystemSharp: MathExt.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">SystemSharp
   &#160;<span id="projectnumber">0.3</span>
   </div>
   <div id="projectbrief">A system-level modeling framework for designing real-time embedded systems</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Packages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_math_ext_8cs_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Properties</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Events</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">MathExt.cs</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_math_ext_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">using</span> System;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">using</span> System.Collections.Generic;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">using</span> System.Diagnostics.Contracts;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">using</span> System.Linq;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">using</span> System.Reflection;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">using</span> System.Text;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="keyword">using</span> SystemSharp.Assembler;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">using</span> SystemSharp.Components;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">using</span> SystemSharp.DataTypes;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">using</span> SystemSharp.Meta;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keyword">using</span> SystemSharp.SysDOM;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="namespace_system_sharp_1_1_common.html">   32</a></span>&#160;<span class="keyword">namespace </span>SystemSharp.Common</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;{</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html">   37</a></span>&#160;    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">class </span><a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html">MathExt</a></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    {</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a4b2e7feb6ba6b178967eeab53c122705">   44</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a4b2e7feb6ba6b178967eeab53c122705">CeilPow2</a>(<span class="keywordtype">int</span> number)</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        {</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &gt;= 0 &amp;&amp; number &lt;= int.MaxValue/2, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;            <span class="keywordtype">int</span> pow2 = 1;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        }</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a73755fbe16c6e7cabd6dafd6c8e1e811">   60</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> uint <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a73755fbe16c6e7cabd6dafd6c8e1e811">CeilPow2</a>(uint number)</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &lt;= uint.MaxValue / 2 + 1, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;            uint pow2 = 1;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        }</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#ac96413cf918bc42968342161d929eee0">   76</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> ulong <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#ac96413cf918bc42968342161d929eee0">CeilPow2</a>(ulong number)</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        {</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &lt;= ulong.MaxValue / 2 + 1, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            ulong pow2 = 1;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        }</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a547d7f40005cc7f6d3a818159f0a54ea">   92</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> ulong <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a547d7f40005cc7f6d3a818159f0a54ea">CeilPow2</a>(<span class="keywordtype">double</span> number)</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &gt;= 0 &amp;&amp; number &lt;= ulong.MaxValue / 2 + 1, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            ulong pow2 = 1;</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a8da768c3424f3b6ce0785d240111f9a6">  108</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a8da768c3424f3b6ce0785d240111f9a6">FloorPow2</a>(<span class="keywordtype">int</span> number)</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        {</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &gt;= 0, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;            <span class="keywordflow">if</span> (number &gt; (<span class="keywordtype">int</span>.MaxValue / 2 + 1))</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                <span class="keywordflow">return</span> <span class="keywordtype">int</span>.MaxValue / 2 + 1;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;            <span class="keywordtype">int</span> pow2 = 1;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            <span class="keywordflow">if</span> (pow2 &gt; number)</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                pow2 /= 2;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#abc51db0046fee0a17e8f4491fc5a4164">  128</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> ulong <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#abc51db0046fee0a17e8f4491fc5a4164">FloorPow2</a>(ulong number)</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        {</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            <span class="keywordflow">if</span> (number &gt; (ulong.MaxValue / 2 + 1))</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                <span class="keywordflow">return</span> ulong.MaxValue / 2 + 1;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            ulong pow2 = 1;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;            <span class="keywordflow">while</span> (pow2 &lt; number)</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;                pow2 *= 2;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            <span class="keywordflow">if</span> (pow2 &gt; number)</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;                pow2 /= 2;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;            <span class="keywordflow">return</span> pow2;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a9c866c9fc9b5d922c923f2bcf919335e">  146</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a9c866c9fc9b5d922c923f2bcf919335e">FloorLog2</a>(<span class="keywordtype">long</span> number)</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        {</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            <span class="keywordtype">int</span> result = -1;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;            <span class="keywordflow">while</span> (number &gt; 0)</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;            {</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                number /= 2;</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                result++;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            }</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        }</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aacee9ed80323eb255dd905d1ee16f8e9">  161</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aacee9ed80323eb255dd905d1ee16f8e9">FloorLog2</a>(ulong number)</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        {</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            <span class="keywordtype">int</span> result = -1;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            <span class="keywordflow">while</span> (number &gt; 0)</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;            {</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                number /= 2;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                result++;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        }</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aae4b6cd0984bab7b3fee85f4e6d496b0">  176</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aae4b6cd0984bab7b3fee85f4e6d496b0">CeilLog2</a>(<span class="keywordtype">int</span> number)</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            <span class="keywordflow">if</span> (number &lt;= 0)</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (IsPow2(number))</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                <span class="keywordflow">return</span> FloorLog2(number);</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                <span class="keywordflow">return</span> FloorLog2(number) + 1;</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;        }</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;</div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a8d1e636f15f22e1bcd3fa1cbcf97c66a">  190</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a8d1e636f15f22e1bcd3fa1cbcf97c66a">CeilLog2</a>(ulong number)</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        {</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            <span class="keywordflow">if</span> (number == 0)</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (IsPow2(number))</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                <span class="keywordflow">return</span> FloorLog2(number);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;                <span class="keywordflow">return</span> FloorLog2(number) + 1;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;        }</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div>
<div class="line"><a name="l00205"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#abf898566e8553245eee003b39b7b3ddc">  205</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#abf898566e8553245eee003b39b7b3ddc">CeilLog2</a>(<span class="keywordtype">double</span> number)</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        {</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &gt; 0, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;            <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)Math.Ceiling(Math.Log(number, 2.0));</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        }</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;</div>
<div class="line"><a name="l00217"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a5bb12a753e6a855ad70ac552c29f82d2">  217</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a5bb12a753e6a855ad70ac552c29f82d2">FloorLog2</a>(<span class="keywordtype">double</span> number)</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;        {</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(number &gt; 0, <span class="stringliteral">&quot;number&quot;</span>);</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;            <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)Math.Floor(Math.Log(number, 2.0));</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;        }</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;</div>
<div class="line"><a name="l00228"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a211fd6cfa3f0906c3606837fd28db1ad">  228</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a211fd6cfa3f0906c3606837fd28db1ad">IsPow2</a>(<span class="keywordtype">long</span> number)</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;        {</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;            <span class="keywordflow">return</span> (number &amp; (number - 1)) == 0;</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;        }</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#adcf787281c09912b28d5d501a93287ef">  237</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#adcf787281c09912b28d5d501a93287ef">IsPow2</a>(ulong number)</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;        {</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;            <span class="keywordflow">return</span> (number &amp; (number - 1)) == 0;</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;        }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a5d698326cece717fea170af80f3fcdd4">  246</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> ulong <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a5d698326cece717fea170af80f3fcdd4">Align</a>(ulong number, ulong alignment)</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;        {</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;            Contract.Requires&lt;DivideByZeroException&gt;(alignment != 0, <span class="stringliteral">&quot;alignment&quot;</span>);</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;            <span class="keywordflow">return</span> (number + alignment - 1) / alignment * alignment;</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        }</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sign)]</div>
<div class="line"><a name="l00260"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a9efd72ddd9b28190ca805d9f968f99d0">  260</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a9efd72ddd9b28190ca805d9f968f99d0">SignedSign</a>(<span class="keywordtype">float</span> number)</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            <span class="keywordflow">if</span> (number &lt; 0.0f)</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(-1, 2);</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (number &gt; 0.0f)</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(1, 2);</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(0, 2);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        }</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sign)]</div>
<div class="line"><a name="l00277"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a51f762e06bf88447a00484211803c78a">  277</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a51f762e06bf88447a00484211803c78a">SignedSign</a>(<span class="keywordtype">double</span> number)</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;        {</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;            <span class="keywordflow">if</span> (number &lt; 0.0)</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(-1, 2);</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (number &gt; 0.0)</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(1, 2);</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(0, 2);</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;        }</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sign)]</div>
<div class="line"><a name="l00294"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a00b70af48cce2c91a027da714b806aee">  294</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a00b70af48cce2c91a027da714b806aee">SignedSign</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> number)</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;        {</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;            <span class="keywordflow">if</span> (number &lt; <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#ad4db0681eed1f599c03218669355296c">Zero</a>)</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(-1, 2);</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (number &gt; <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#ad4db0681eed1f599c03218669355296c">Zero</a>)</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(1, 2);</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(0, 2);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        }</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sign)]</div>
<div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aee95bb9e5bfb447f048de0e1f774dbb1">  311</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aee95bb9e5bfb447f048de0e1f774dbb1">SignedSign</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> number)</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;        {</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;            <span class="keywordflow">if</span> (number &lt; <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a11f4267ef92a5206762b7507c9ef3bd9">Zero</a>)</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(-1, 2);</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (number &gt; <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a11f4267ef92a5206762b7507c9ef3bd9">Zero</a>)</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(1, 2);</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;            <span class="keywordflow">else</span></div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;                <span class="keywordflow">return</span> Signed.FromInt(0, 2);</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;        }</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="preprocessor">#if USE_INTX</span></div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;<span class="preprocessor"></span>        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_unsigned.html">Unsigned</a> Abs(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> value)</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        {</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;            <span class="keywordflow">return</span> value.IntXValue &lt; 0 ?</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;                Unsigned.FromIntX(-value.IntXValue, value.Size) :</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;                <a class="code" href="struct_system_sharp_1_1_data_types_1_1_unsigned.html">Unsigned</a>.FromIntX(value.IntXValue, value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#a9dd650cf08231747180c3f02f72aa2fc">Size</a>);</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;        }</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> SignedAbs(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> value)</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;        {</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;            <span class="keywordflow">return</span> value.IntXValue &lt; 0 ?</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;                (-value).Resize(value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#a9dd650cf08231747180c3f02f72aa2fc">Size</a> + 1) :</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;                value.Resize(value.<a class="code" href="namespace_system_sharp_1_1_data_types.html#aaa77d3e1a986cc90a1b9f920579b78d3a6f6cb72d544962fa333e2e34ce64f719">Size</a> + 1);</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        }</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;<span class="preprocessor"></span>        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a6ec6a82dad694ed5b14ae4b8fa4ff6bd">  342</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_unsigned.html">Unsigned</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a6ec6a82dad694ed5b14ae4b8fa4ff6bd">Abs</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> value)</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        {</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;            <span class="keywordflow">return</span> value.BigIntValue.Sign &lt; 0 ?</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;                Unsigned.FromBigInt(-value.BigIntValue, value.Size) :</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;                <a class="code" href="struct_system_sharp_1_1_data_types_1_1_unsigned.html">Unsigned</a>.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_unsigned.html#a2f48b59cf83808aa61c850ac6bebb54b">FromBigInt</a>(value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#a07e1c1eac203fe9800da493287c813c9">BigIntValue</a>, value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#a9dd650cf08231747180c3f02f72aa2fc">Size</a>);</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;        }</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00354"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aae470d37142b941ca626a83270d92465">  354</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aae470d37142b941ca626a83270d92465">SignedAbs</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html">Signed</a> value)</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;        {</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;            <span class="keywordflow">return</span> value.BigIntValue.Sign &lt; 0 ?</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;                (-value).Resize(value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_signed.html#a9dd650cf08231747180c3f02f72aa2fc">Size</a> + 1) :</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;                value.Resize(value.Size + 1);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;        }</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00367"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#ab7c7ea083a62b2172f567bb7650e029d">  367</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_u_fix.html">UFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#ab7c7ea083a62b2172f567bb7650e029d">Abs</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value)</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        {</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;            <span class="keywordflow">return</span> UFix.FromUnsigned(</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;                Abs(value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#ae5d720e900e7c1ec9925c9eba4881aa8">SignedValue</a>),</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;                value.Format.FracWidth);</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;        }</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Abs)]</div>
<div class="line"><a name="l00380"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aa512a47e4b1bb04f40481f96d32556d8">  380</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aa512a47e4b1bb04f40481f96d32556d8">SignedAbs</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value)</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;        {</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;            <span class="keywordflow">return</span> SFix.FromSigned(</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;                SignedAbs(value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#ae5d720e900e7c1ec9925c9eba4881aa8">SignedValue</a>), </div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;                value.Format.FracWidth);</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        }</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sqrt)]</div>
<div class="line"><a name="l00397"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#abe4823086728c9c77588c628a962a245">  397</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_u_fix.html">UFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#abe4823086728c9c77588c628a962a245">Sqrt</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_u_fix.html">UFix</a> value)</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        {</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;            <span class="keywordtype">int</span> iw = (value.Format.IntWidth + 1) / 2;</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;            <span class="keywordflow">return</span> UFix.FromDouble(</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;                Math.Sqrt(value.DoubleValue),</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;                iw,</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;                value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_u_fix.html#a8c9d7b25ebe80660ba6afd2f374428f1">Format</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_fix_format.html#ae93e868bbcb07d3f2629e50333d28392">TotalWidth</a> - iw);</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;        }</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sin)]</div>
<div class="line"><a name="l00416"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a40e016db708bbfb1ef078c9c4dd01784">  416</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a40e016db708bbfb1ef078c9c4dd01784">Sin</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value, <span class="keywordtype">int</span> fracWidth)</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;        {</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(fracWidth &gt;= 0, <span class="stringliteral">&quot;fracWidth&quot;</span>);</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;            <span class="keywordflow">return</span> SFix.FromDouble(</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;                Math.Sin(value.DoubleValue),</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;                2,</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;                fracWidth);</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;        }</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Cos)]</div>
<div class="line"><a name="l00436"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a93c7e0bf7771b341d91da12e5384d460">  436</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a93c7e0bf7771b341d91da12e5384d460">Cos</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value, <span class="keywordtype">int</span> fracWidth)</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;        {</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(fracWidth &gt;= 0, <span class="stringliteral">&quot;fracWidth&quot;</span>);</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;            <span class="keywordflow">return</span> SFix.FromDouble(</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;                Math.Cos(value.DoubleValue),</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;                2,</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;                fracWidth);</div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;        }</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Sin)]</div>
<div class="line"><a name="l00456"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a95675c267e93fa55c09807b7f15075f2">  456</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a95675c267e93fa55c09807b7f15075f2">Sin</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value)</div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;        {</div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(value.Format.FracWidth &gt;= 0, <span class="stringliteral">&quot;value.Format.FracWidth&quot;</span>);</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;            <span class="keywordflow">return</span> SFix.FromDouble(</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;                Math.Sin(value.DoubleValue),</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;                2,</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;                value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a0da5dbdc6a2876f2d1b65184dc61e48d">Format</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_fix_format.html#a0246244153fe96028ad07a8451585908">FracWidth</a>);</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;        }</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;        [<a class="code" href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">MapToIntrinsicFunction</a>(SysDOM.IntrinsicFunction.EAction.Cos)]</div>
<div class="line"><a name="l00476"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#ab6c5fc632a44437ce5aca257caf43fed">  476</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#ab6c5fc632a44437ce5aca257caf43fed">Cos</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value)</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        {</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(value.Format.FracWidth &gt;= 0, <span class="stringliteral">&quot;value.Format.FracWidth&quot;</span>);</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;            <span class="keywordflow">return</span> SFix.FromDouble(</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;                Math.Sin(value.DoubleValue),</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;                2,</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;                value.<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a0da5dbdc6a2876f2d1b65184dc61e48d">Format</a>.<a class="code" href="class_system_sharp_1_1_data_types_1_1_fix_format.html#a0246244153fe96028ad07a8451585908">FracWidth</a>);</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;        }</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;        <span class="keyword">private</span> <span class="keyword">class </span>MapToScSinCos : <a class="code" href="class_system_sharp_1_1_components_1_1_rewrite_call.html">RewriteCall</a>, <a class="code" href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">IDoNotAnalyze</a></div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;        {</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;            <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">bool</span> Rewrite(Meta.CodeDescriptor decompilee, System.Reflection.MethodBase callee, Analysis.StackElement[] args, Analysis.IDecompiler stack, <a class="code" href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">IFunctionBuilder</a> builder)</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;            {</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;                <span class="keywordtype">object</span>[] outArgs;</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;                <span class="keywordtype">object</span> sample;</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;                <span class="keywordflow">if</span> (!stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out sample))</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;                    <span class="keywordflow">throw</span> <span class="keyword">new</span> InvalidOperationException(<span class="stringliteral">&quot;Unable to create sample for ScSinCos call&quot;</span>);</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;                var fcall = IntrinsicFunctions.XILOpCode(</div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;                    <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_assembler_1_1_x_i_l_instr.html">XILInstr</a>(<a class="code" href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html">InstructionCodes</a>.<a class="code" href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html#a96121659a31404af9d62ede965af2da6">ScSinCos</a>), </div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;                    TypeDescriptor.GetTypeOf(sample),</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;                    <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_expression.html">Expression</a>[] { args[0].Expr });</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;                stack.Push(fcall, sample);</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;            }</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;        }</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;        [MapToScSinCos]</div>
<div class="line"><a name="l00518"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#aa2f9d9f9d333ee51c849b1e21d1df1e7">  518</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> Tuple&lt;SFix, SFix&gt; <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#aa2f9d9f9d333ee51c849b1e21d1df1e7">ScSinCos</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value, <span class="keywordtype">int</span> resultFracBits)</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;        {</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(value.DoubleValue &gt;= -1.0, <span class="stringliteral">&quot;value&quot;</span>);</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(value.DoubleValue &lt;= 1.0, <span class="stringliteral">&quot;value&quot;</span>);</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;            Contract.Requires&lt;ArgumentOutOfRangeException&gt;(resultFracBits &gt;= 0, <span class="stringliteral">&quot;resultFracBits&quot;</span>);</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;            var result = Tuple.Create(</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;                SFix.FromDouble(</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;                    Math.Cos(Math.PI * value.DoubleValue),</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;                    2,</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;                    resultFracBits),</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;                SFix.FromDouble(</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;                    Math.Sin(Math.PI * value.DoubleValue),</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;                    2,</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;                    resultFracBits));</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;        }</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;        [MapToScSinCos]</div>
<div class="line"><a name="l00543"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a22654cef75fd7702442e371f00e2aa96">  543</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> Tuple&lt;double, double&gt; <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a22654cef75fd7702442e371f00e2aa96">ScSinCos</a>(<span class="keywordtype">double</span> value)</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;        {</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;            var result = Tuple.Create(</div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;                    Math.Cos(Math.PI * value),</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;                    Math.Sin(Math.PI * value));</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;        }</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;        <span class="keyword">private</span> <span class="keyword">class </span>MapToRempow2 : <a class="code" href="class_system_sharp_1_1_components_1_1_rewrite_call.html">RewriteCall</a>, <a class="code" href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">IDoNotAnalyze</a></div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;        {</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;            <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">bool</span> Rewrite(Meta.CodeDescriptor decompilee, System.Reflection.MethodBase callee, Analysis.StackElement[] args, Analysis.IDecompiler stack, <a class="code" href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">IFunctionBuilder</a> builder)</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;            {</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;                <span class="keywordtype">object</span>[] outArgs;</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;                <span class="keywordtype">object</span> sample;</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;                <span class="keywordflow">if</span> (!stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out sample))</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;                    <span class="keywordflow">throw</span> <span class="keyword">new</span> InvalidOperationException(<span class="stringliteral">&quot;Unable to create sample for ScSinCos call&quot;</span>);</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;                <span class="keywordflow">if</span> (args[1].Variability != Analysis.Msil.EVariability.Constant)</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;                    <span class="keywordflow">throw</span> <span class="keyword">new</span> InvalidOperationException(<span class="stringliteral">&quot;n argument of Rempow2 must be a constant&quot;</span>);</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;                var fcall = IntrinsicFunctions.XILOpCode(</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;                    <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_assembler_1_1_x_i_l_instr.html">XILInstr</a>(<a class="code" href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html">InstructionCodes</a>.<a class="code" href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html#a5be0eaaeb47aedb7d96cee549cb5e605">Rempow2</a>, (<span class="keywordtype">int</span>)args[1].Sample),</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;                    TypeDescriptor.GetTypeOf(sample),</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;                    <span class="keyword">new</span> <a class="code" href="class_system_sharp_1_1_sys_d_o_m_1_1_expression.html">Expression</a>[] { args[0].Expr });</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;                stack.Push(fcall, sample);</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;            }</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;        }</div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;        [MapToRempow2]</div>
<div class="line"><a name="l00579"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a30f0525b01304f2276fde4c6f02f5778">  579</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a30f0525b01304f2276fde4c6f02f5778">Rempow2</a>(<a class="code" href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SFix</a> value, <span class="keywordtype">int</span> n)</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;        {</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;            var rem = SFix.FromSigned(Signed.One, -n);</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;            <span class="keywordflow">return</span> value % rem;</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;        }</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;        [MapToRempow2]</div>
<div class="line"><a name="l00589"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a62aaaf71102eea889e0831dd9d29e1cd">  589</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="class_system_sharp_1_1_common_1_1_math_ext.html#a62aaaf71102eea889e0831dd9d29e1cd">Rempow2</a>(<span class="keywordtype">double</span> value, <span class="keywordtype">int</span> n)</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;        {</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;            <span class="keywordflow">return</span> Math.IEEERemainder(value, 1 &lt;&lt; (n+1));</div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;        }</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;        [AttributeUsage(AttributeTargets.Method, AllowMultiple = <span class="keyword">false</span>, Inherited = <span class="keyword">true</span>)]</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        <span class="keyword">private</span> <span class="keyword">class </span>MapToConditional : <a class="code" href="class_system_sharp_1_1_components_1_1_rewrite_call.html">RewriteCall</a>, <a class="code" href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">IDoNotAnalyze</a></div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;        {</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;            <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">bool</span> Rewrite(Meta.CodeDescriptor decompilee, System.Reflection.MethodBase callee, Analysis.StackElement[] args, Analysis.IDecompiler stack, SysDOM.IFunctionBuilder builder)</div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;            {</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;                stack.Push(</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;                    Expression.Conditional(args[0].Expr, args[1].Expr, args[2].Expr),</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;                    args[1].Sample);</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;            }</div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;        }</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;        [MapToConditional]</div>
<div class="line"><a name="l00610"></a><span class="lineno"><a class="line" href="class_system_sharp_1_1_common_1_1_math_ext.html#a0b321a2b8567ad20e81bffd94dc9b2b6">  610</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">static</span> T Select&lt;T&gt;(<span class="keywordtype">bool</span> cond, T trueVal, T falseVal)</div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;        {</div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;            <span class="keywordflow">return</span> cond ? trueVal : falseVal;</div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;        }</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    }</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;}</div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_ac96413cf918bc42968342161d929eee0"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#ac96413cf918bc42968342161d929eee0">SystemSharp.Common.MathExt.CeilPow2</a></div><div class="ttdeci">static ulong CeilPow2(ulong number)</div><div class="ttdoc">Returns the smallest number P, such that P &gt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00076">MathExt.cs:76</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_map_to_intrinsic_function.html">SystemSharp.Components.MapToIntrinsicFunction</a></div><div class="ttdoc">Any call to the tagged method will be translated to a SysDOM-intrinsic function call during decompila...</div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l00512">ComponentsAttributes.cs:512</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html">SystemSharp.Common.MathExt</a></div><div class="ttdoc">This static class provides some specialized mathematical operations. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00037">MathExt.cs:37</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_s_fix_html_a0da5dbdc6a2876f2d1b65184dc61e48d"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a0da5dbdc6a2876f2d1b65184dc61e48d">SystemSharp.DataTypes.SFix.Format</a></div><div class="ttdeci">FixFormat Format</div><div class="ttdoc">The format description of this fixed-point number </div><div class="ttdef"><b>Definition:</b> <a href="_s_fix_8cs_source.html#l00136">SFix.cs:136</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a62aaaf71102eea889e0831dd9d29e1cd"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a62aaaf71102eea889e0831dd9d29e1cd">SystemSharp.Common.MathExt.Rempow2</a></div><div class="ttdeci">static double Rempow2(double value, int n)</div><div class="ttdoc">Computes the remainder value  mod 2^n. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00589">MathExt.cs:589</a></div></div>
<div class="ttc" id="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder_html"><div class="ttname"><a href="interface_system_sharp_1_1_sys_d_o_m_1_1_i_function_builder.html">SystemSharp.SysDOM.IFunctionBuilder</a></div><div class="ttdoc">Extends the algorithm builder interface by the capability of creating a SysDOM function. </div><div class="ttdef"><b>Definition:</b> <a href="_algorithms_8cs_source.html#l01810">Algorithms.cs:1810</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_adcf787281c09912b28d5d501a93287ef"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#adcf787281c09912b28d5d501a93287ef">SystemSharp.Common.MathExt.IsPow2</a></div><div class="ttdeci">static bool IsPow2(ulong number)</div><div class="ttdoc">Determines whether number  is a power of 2 </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00237">MathExt.cs:237</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aa2f9d9f9d333ee51c849b1e21d1df1e7"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aa2f9d9f9d333ee51c849b1e21d1df1e7">SystemSharp.Common.MathExt.ScSinCos</a></div><div class="ttdeci">static Tuple&lt; SFix, SFix &gt; ScSinCos(SFix value, int resultFracBits)</div><div class="ttdoc">Computes both sine and cosine of value , specified in scaled radians. The conversion to radians is do...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00518">MathExt.cs:518</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a93c7e0bf7771b341d91da12e5384d460"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a93c7e0bf7771b341d91da12e5384d460">SystemSharp.Common.MathExt.Cos</a></div><div class="ttdeci">static SFix Cos(SFix value, int fracWidth)</div><div class="ttdoc">Computes the cosine of value . The result integer width is always 2 bits, result fractional width is ...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00436">MathExt.cs:436</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_abe4823086728c9c77588c628a962a245"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#abe4823086728c9c77588c628a962a245">SystemSharp.Common.MathExt.Sqrt</a></div><div class="ttdeci">static UFix Sqrt(UFix value)</div><div class="ttdoc">Computes the square root of value . The result format is as follows: Result integer width is ceil(val...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00397">MathExt.cs:397</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_sys_d_o_m_1_1_expression_html"><div class="ttname"><a href="class_system_sharp_1_1_sys_d_o_m_1_1_expression.html">SystemSharp.SysDOM.Expression</a></div><div class="ttdoc">An expression. </div><div class="ttdef"><b>Definition:</b> <a href="_core_algebraic_8cs_source.html#l01096">CoreAlgebraic.cs:1096</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aa512a47e4b1bb04f40481f96d32556d8"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aa512a47e4b1bb04f40481f96d32556d8">SystemSharp.Common.MathExt.SignedAbs</a></div><div class="ttdeci">static SFix SignedAbs(SFix value)</div><div class="ttdoc">Returns the absolute value of value  as SFix datatype. Consequently, the most significant bit of the ...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00380">MathExt.cs:380</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aae4b6cd0984bab7b3fee85f4e6d496b0"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aae4b6cd0984bab7b3fee85f4e6d496b0">SystemSharp.Common.MathExt.CeilLog2</a></div><div class="ttdeci">static int CeilLog2(int number)</div><div class="ttdoc">Computes ceil(log2(number )) for positive numbers, returns -1 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00176">MathExt.cs:176</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_fix_format_html_a0246244153fe96028ad07a8451585908"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_fix_format.html#a0246244153fe96028ad07a8451585908">SystemSharp.DataTypes.FixFormat.FracWidth</a></div><div class="ttdeci">int FracWidth</div><div class="ttdoc">Fractional width </div><div class="ttdef"><b>Definition:</b> <a href="_fix_point_math_8cs_source.html#l00252">FixPointMath.cs:252</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a547d7f40005cc7f6d3a818159f0a54ea"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a547d7f40005cc7f6d3a818159f0a54ea">SystemSharp.Common.MathExt.CeilPow2</a></div><div class="ttdeci">static ulong CeilPow2(double number)</div><div class="ttdoc">Returns the smallest number P, such that P &gt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00092">MathExt.cs:92</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_abc51db0046fee0a17e8f4491fc5a4164"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#abc51db0046fee0a17e8f4491fc5a4164">SystemSharp.Common.MathExt.FloorPow2</a></div><div class="ttdeci">static ulong FloorPow2(ulong number)</div><div class="ttdoc">Returns the largest number P, such that P &lt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00128">MathExt.cs:128</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a8d1e636f15f22e1bcd3fa1cbcf97c66a"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a8d1e636f15f22e1bcd3fa1cbcf97c66a">SystemSharp.Common.MathExt.CeilLog2</a></div><div class="ttdeci">static int CeilLog2(ulong number)</div><div class="ttdoc">Computes ceil(log2(number )) for positive numbers, returns -1 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00190">MathExt.cs:190</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_data_types_1_1_fix_format_html_ae93e868bbcb07d3f2629e50333d28392"><div class="ttname"><a href="class_system_sharp_1_1_data_types_1_1_fix_format.html#ae93e868bbcb07d3f2629e50333d28392">SystemSharp.DataTypes.FixFormat.TotalWidth</a></div><div class="ttdeci">int TotalWidth</div><div class="ttdoc">total number of bits required to represent an number in this format, i.e. IntWidth + FracWidth...</div><div class="ttdef"><b>Definition:</b> <a href="_fix_point_math_8cs_source.html#l00271">FixPointMath.cs:271</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a00b70af48cce2c91a027da714b806aee"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a00b70af48cce2c91a027da714b806aee">SystemSharp.Common.MathExt.SignedSign</a></div><div class="ttdeci">static Signed SignedSign(Signed number)</div><div class="ttdoc">Returns the sign of number  as Signed: Signed.FromInt(-1, 2) if number  &lt; 0, Signed.FromInt(1, 2) if number  &gt; 0, Signed.FromInt(0, 2) if number  == 0. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00294">MathExt.cs:294</a></div></div>
<div class="ttc" id="namespace_system_sharp_1_1_data_types_html_aaa77d3e1a986cc90a1b9f920579b78d3a6f6cb72d544962fa333e2e34ce64f719"><div class="ttname"><a href="namespace_system_sharp_1_1_data_types.html#aaa77d3e1a986cc90a1b9f920579b78d3a6f6cb72d544962fa333e2e34ce64f719">SystemSharp.DataTypes.Size</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a30f0525b01304f2276fde4c6f02f5778"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a30f0525b01304f2276fde4c6f02f5778">SystemSharp.Common.MathExt.Rempow2</a></div><div class="ttdeci">static SFix Rempow2(SFix value, int n)</div><div class="ttdoc">Computes the remainder value  mod 2^n. Result integer width is 2 + n . Result fractional width is max...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00579">MathExt.cs:579</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_signed_html_a9dd650cf08231747180c3f02f72aa2fc"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_signed.html#a9dd650cf08231747180c3f02f72aa2fc">SystemSharp.DataTypes.Signed.Size</a></div><div class="ttdeci">int Size</div><div class="ttdoc">Returns the size (in bits) of this value. </div><div class="ttdef"><b>Definition:</b> <a href="_signed_8cs_source.html#l00961">Signed.cs:961</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_u_fix_html_a8c9d7b25ebe80660ba6afd2f374428f1"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_u_fix.html#a8c9d7b25ebe80660ba6afd2f374428f1">SystemSharp.DataTypes.UFix.Format</a></div><div class="ttdeci">FixFormat Format</div><div class="ttdoc">The format description of this fixed-point number </div><div class="ttdef"><b>Definition:</b> <a href="_u_fix_8cs_source.html#l00152">UFix.cs:152</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a9c866c9fc9b5d922c923f2bcf919335e"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a9c866c9fc9b5d922c923f2bcf919335e">SystemSharp.Common.MathExt.FloorLog2</a></div><div class="ttdeci">static int FloorLog2(long number)</div><div class="ttdoc">Computes floor(log2(number )) for positive numbers, returns -1 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00146">MathExt.cs:146</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_u_fix_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_u_fix.html">SystemSharp.DataTypes.UFix</a></div><div class="ttdoc">An unsigned fixed-point number </div><div class="ttdef"><b>Definition:</b> <a href="_u_fix_8cs_source.html#l00116">UFix.cs:116</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a6ec6a82dad694ed5b14ae4b8fa4ff6bd"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a6ec6a82dad694ed5b14ae4b8fa4ff6bd">SystemSharp.Common.MathExt.Abs</a></div><div class="ttdeci">static Unsigned Abs(Signed value)</div><div class="ttdoc">Returns the absolute value of value . The result will have exactly the same bitwidth as the operand...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00342">MathExt.cs:342</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a5bb12a753e6a855ad70ac552c29f82d2"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a5bb12a753e6a855ad70ac552c29f82d2">SystemSharp.Common.MathExt.FloorLog2</a></div><div class="ttdeci">static int FloorLog2(double number)</div><div class="ttdoc">Computes floor(log2(number )) for positive numbers </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00217">MathExt.cs:217</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_unsigned_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_unsigned.html">SystemSharp.DataTypes.Unsigned</a></div><div class="ttdoc">An unsigned integer </div><div class="ttdef"><b>Definition:</b> <a href="_unsigned_8cs_source.html#l00637">Unsigned.cs:637</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aee95bb9e5bfb447f048de0e1f774dbb1"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aee95bb9e5bfb447f048de0e1f774dbb1">SystemSharp.Common.MathExt.SignedSign</a></div><div class="ttdeci">static Signed SignedSign(SFix number)</div><div class="ttdoc">Returns the sign of number  as Signed: Signed.FromInt(-1, 2) if number  &lt; 0, Signed.FromInt(1, 2) if number  &gt; 0, Signed.FromInt(0, 2) if number  == 0. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00311">MathExt.cs:311</a></div></div>
<div class="ttc" id="interface_system_sharp_1_1_components_1_1_i_do_not_analyze_html"><div class="ttname"><a href="interface_system_sharp_1_1_components_1_1_i_do_not_analyze.html">SystemSharp.Components.IDoNotAnalyze</a></div><div class="ttdoc">Marker interface for methods which must not be included into system analysis. </div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l01234">ComponentsAttributes.cs:1234</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a51f762e06bf88447a00484211803c78a"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a51f762e06bf88447a00484211803c78a">SystemSharp.Common.MathExt.SignedSign</a></div><div class="ttdeci">static Signed SignedSign(double number)</div><div class="ttdoc">Returns the sign of number  as Signed: Signed.FromInt(-1, 2) if number  &lt; 0, Signed.FromInt(1, 2) if number  &gt; 0, Signed.FromInt(0, 2) if number  == 0. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00277">MathExt.cs:277</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_ab7c7ea083a62b2172f567bb7650e029d"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#ab7c7ea083a62b2172f567bb7650e029d">SystemSharp.Common.MathExt.Abs</a></div><div class="ttdeci">static UFix Abs(SFix value)</div><div class="ttdoc">Returns the absolute value of value . The result will have exactly the same integer and fractional bi...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00367">MathExt.cs:367</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_s_fix_html_ae5d720e900e7c1ec9925c9eba4881aa8"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#ae5d720e900e7c1ec9925c9eba4881aa8">SystemSharp.DataTypes.SFix.SignedValue</a></div><div class="ttdeci">Signed SignedValue</div><div class="ttdoc">Re-interprets this value as signed integer, i.e. the binary two&#39;s complement representation is re-int...</div><div class="ttdef"><b>Definition:</b> <a href="_s_fix_8cs_source.html#l00616">SFix.cs:616</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a5d698326cece717fea170af80f3fcdd4"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a5d698326cece717fea170af80f3fcdd4">SystemSharp.Common.MathExt.Align</a></div><div class="ttdeci">static ulong Align(ulong number, ulong alignment)</div><div class="ttdoc">Finds the largest integer N, such that N &lt;= number  and N is divisble by alignment ...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00246">MathExt.cs:246</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_unsigned_html_a2f48b59cf83808aa61c850ac6bebb54b"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_unsigned.html#a2f48b59cf83808aa61c850ac6bebb54b">SystemSharp.DataTypes.Unsigned.FromBigInt</a></div><div class="ttdeci">static Unsigned FromBigInt(BigInteger value, int size)</div><div class="ttdoc">Converts a non-negative BigInteger value to an Unsigned value. </div><div class="ttdef"><b>Definition:</b> <a href="_unsigned_8cs_source.html#l00753">Unsigned.cs:753</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_assembler_1_1_instruction_codes_html"><div class="ttname"><a href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html">SystemSharp.Assembler.InstructionCodes</a></div><div class="ttdoc">All XIL opcodes </div><div class="ttdef"><b>Definition:</b> <a href="_instruction_set_8cs_source.html#l00036">InstructionSet.cs:36</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_signed_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_signed.html">SystemSharp.DataTypes.Signed</a></div><div class="ttdoc">Signed integer of arbitrary size </div><div class="ttdef"><b>Definition:</b> <a href="_signed_8cs_source.html#l00634">Signed.cs:634</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_s_fix_html_a11f4267ef92a5206762b7507c9ef3bd9"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_s_fix.html#a11f4267ef92a5206762b7507c9ef3bd9">SystemSharp.DataTypes.SFix.Zero</a></div><div class="ttdeci">static readonly SFix Zero</div><div class="ttdoc">Fixed-point zero with 1 bit integer width and 0 bits fractional width </div><div class="ttdef"><b>Definition:</b> <a href="_s_fix_8cs_source.html#l00121">SFix.cs:121</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a4b2e7feb6ba6b178967eeab53c122705"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a4b2e7feb6ba6b178967eeab53c122705">SystemSharp.Common.MathExt.CeilPow2</a></div><div class="ttdeci">static int CeilPow2(int number)</div><div class="ttdoc">Returns the smallest number P, such that P &gt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00044">MathExt.cs:44</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a22654cef75fd7702442e371f00e2aa96"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a22654cef75fd7702442e371f00e2aa96">SystemSharp.Common.MathExt.ScSinCos</a></div><div class="ttdeci">static Tuple&lt; double, double &gt; ScSinCos(double value)</div><div class="ttdoc">Computes both sine and cosine of value , specified in scaled radians. The conversion to radians is do...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00543">MathExt.cs:543</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_ab6c5fc632a44437ce5aca257caf43fed"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#ab6c5fc632a44437ce5aca257caf43fed">SystemSharp.Common.MathExt.Cos</a></div><div class="ttdeci">static SFix Cos(SFix value)</div><div class="ttdoc">Computes the cosine of value . The result integer width is always 2 bits, result fractional width is ...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00476">MathExt.cs:476</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_s_fix_html"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_s_fix.html">SystemSharp.DataTypes.SFix</a></div><div class="ttdoc">A signed fixed-point number </div><div class="ttdef"><b>Definition:</b> <a href="_s_fix_8cs_source.html#l00116">SFix.cs:116</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_signed_html_a07e1c1eac203fe9800da493287c813c9"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_signed.html#a07e1c1eac203fe9800da493287c813c9">SystemSharp.DataTypes.Signed.BigIntValue</a></div><div class="ttdeci">BigInteger BigIntValue</div><div class="ttdoc">Converts this value to its BigInteger representation. </div><div class="ttdef"><b>Definition:</b> <a href="_signed_8cs_source.html#l00821">Signed.cs:821</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a40e016db708bbfb1ef078c9c4dd01784"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a40e016db708bbfb1ef078c9c4dd01784">SystemSharp.Common.MathExt.Sin</a></div><div class="ttdeci">static SFix Sin(SFix value, int fracWidth)</div><div class="ttdoc">Computes the sine of value . The result integer width is always 2 bits, result fractional width is sp...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00416">MathExt.cs:416</a></div></div>
<div class="ttc" id="struct_system_sharp_1_1_data_types_1_1_signed_html_ad4db0681eed1f599c03218669355296c"><div class="ttname"><a href="struct_system_sharp_1_1_data_types_1_1_signed.html#ad4db0681eed1f599c03218669355296c">SystemSharp.DataTypes.Signed.Zero</a></div><div class="ttdeci">static readonly Signed Zero</div><div class="ttdoc">The zero as a single-bit value </div><div class="ttdef"><b>Definition:</b> <a href="_signed_8cs_source.html#l00639">Signed.cs:639</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a8da768c3424f3b6ce0785d240111f9a6"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a8da768c3424f3b6ce0785d240111f9a6">SystemSharp.Common.MathExt.FloorPow2</a></div><div class="ttdeci">static int FloorPow2(int number)</div><div class="ttdoc">Returns the largest number P, such that P &lt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00108">MathExt.cs:108</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aacee9ed80323eb255dd905d1ee16f8e9"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aacee9ed80323eb255dd905d1ee16f8e9">SystemSharp.Common.MathExt.FloorLog2</a></div><div class="ttdeci">static int FloorLog2(ulong number)</div><div class="ttdoc">Computes floor(log2(number )) for positive numbers, returns -1 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00161">MathExt.cs:161</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_components_1_1_rewrite_call_html"><div class="ttname"><a href="class_system_sharp_1_1_components_1_1_rewrite_call.html">SystemSharp.Components.RewriteCall</a></div><div class="ttdoc">If this attribute is attached to any method or constructor, it instructs the decompiler to treat any ...</div><div class="ttdef"><b>Definition:</b> <a href="_components_attributes_8cs_source.html#l00181">ComponentsAttributes.cs:181</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a95675c267e93fa55c09807b7f15075f2"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a95675c267e93fa55c09807b7f15075f2">SystemSharp.Common.MathExt.Sin</a></div><div class="ttdeci">static SFix Sin(SFix value)</div><div class="ttdoc">Computes the sine of value . The result integer width is always 2 bits, result fractional width is th...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00456">MathExt.cs:456</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_abf898566e8553245eee003b39b7b3ddc"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#abf898566e8553245eee003b39b7b3ddc">SystemSharp.Common.MathExt.CeilLog2</a></div><div class="ttdeci">static int CeilLog2(double number)</div><div class="ttdoc">Computes ceil(log2(number )) for positive numbers </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00205">MathExt.cs:205</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_aae470d37142b941ca626a83270d92465"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#aae470d37142b941ca626a83270d92465">SystemSharp.Common.MathExt.SignedAbs</a></div><div class="ttdeci">static Signed SignedAbs(Signed value)</div><div class="ttdoc">Returns the absolute value of value  as Signed datatype. Consequently, the most significant bit of th...</div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00354">MathExt.cs:354</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_assembler_1_1_instruction_codes_html_a96121659a31404af9d62ede965af2da6"><div class="ttname"><a href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html#a96121659a31404af9d62ede965af2da6">SystemSharp.Assembler.InstructionCodes.ScSinCos</a></div><div class="ttdeci">const string ScSinCos</div><div class="ttdoc">Parallel sine and cosine, i.e. ScSinCos(x) = SinCos(2*PI*x) </div><div class="ttdef"><b>Definition:</b> <a href="_instruction_set_8cs_source.html#l00111">InstructionSet.cs:111</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a73755fbe16c6e7cabd6dafd6c8e1e811"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a73755fbe16c6e7cabd6dafd6c8e1e811">SystemSharp.Common.MathExt.CeilPow2</a></div><div class="ttdeci">static uint CeilPow2(uint number)</div><div class="ttdoc">Returns the smallest number P, such that P &gt;= number  and P is a power of 2. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00060">MathExt.cs:60</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a9efd72ddd9b28190ca805d9f968f99d0"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a9efd72ddd9b28190ca805d9f968f99d0">SystemSharp.Common.MathExt.SignedSign</a></div><div class="ttdeci">static Signed SignedSign(float number)</div><div class="ttdoc">Returns the sign of number  as Signed: Signed.FromInt(-1, 2) if number  &lt; 0, Signed.FromInt(1, 2) if number  &gt; 0, Signed.FromInt(0, 2) if number  == 0. </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00260">MathExt.cs:260</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_assembler_1_1_instruction_codes_html_a5be0eaaeb47aedb7d96cee549cb5e605"><div class="ttname"><a href="class_system_sharp_1_1_assembler_1_1_instruction_codes.html#a5be0eaaeb47aedb7d96cee549cb5e605">SystemSharp.Assembler.InstructionCodes.Rempow2</a></div><div class="ttdeci">const string Rempow2</div><div class="ttdoc">Remainder where divisor is fixed power of 2 </div><div class="ttdef"><b>Definition:</b> <a href="_instruction_set_8cs_source.html#l00216">InstructionSet.cs:216</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_assembler_1_1_x_i_l_instr_html"><div class="ttname"><a href="class_system_sharp_1_1_assembler_1_1_x_i_l_instr.html">SystemSharp.Assembler.XILInstr</a></div><div class="ttdoc">Models a XIL instruction </div><div class="ttdef"><b>Definition:</b> <a href="_asm_core_8cs_source.html#l00040">AsmCore.cs:40</a></div></div>
<div class="ttc" id="class_system_sharp_1_1_common_1_1_math_ext_html_a211fd6cfa3f0906c3606837fd28db1ad"><div class="ttname"><a href="class_system_sharp_1_1_common_1_1_math_ext.html#a211fd6cfa3f0906c3606837fd28db1ad">SystemSharp.Common.MathExt.IsPow2</a></div><div class="ttdeci">static bool IsPow2(long number)</div><div class="ttdoc">Determines whether number  is a power of 2 </div><div class="ttdef"><b>Definition:</b> <a href="_math_ext_8cs_source.html#l00228">MathExt.cs:228</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_bb5e995590685548b7e11478911ee7c3.html">SystemSharp-Google-SVN</a></li><li class="navelem"><a class="el" href="dir_8deefa4467a62b572b52d238d562b104.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_0e5a72156f8560bbc472a395da2569d6.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_9d3c30b4336bd92c64ccf0aeee487ace.html">SystemSharp</a></li><li class="navelem"><a class="el" href="dir_f9ef7be6a20c8f1b0769610e52f52090.html">Common</a></li><li class="navelem"><a class="el" href="_math_ext_8cs.html">MathExt.cs</a></li>
    <li class="footer">Generated on Thu Dec 26 2013 14:21:40 for SystemSharp by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
